﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.XCMG.Util;

namespace PMS.XCMG.Entity
{
    /// <summary>
    /// 物料配送记录
    /// </summary>
    public partial class DeliveryExecuted : BusEntity
    {
        /// <summary>
        /// 备料Id
        /// </summary>
        public string PrepareId { set; get; }        
        /// <summary>
        /// Agv调度任务Id
        /// </summary>
        public string DispatchTaskId { set; get; }

        /// <summary>
        /// 配送数量（按台套）
        /// </summary>
        public int Count { set; get; }
        /// <summary>
        /// 配送时间
        /// </summary>
        public DateTime DeliveryTime { set; get; }
    }

    public partial class DeliveryExecuted : BusEntity
    {
    }

    /// <summary>
    /// 实体配置
    /// OnModelCreating
    /// </summary>
    public class DeliveryExecutedTypeConfig : BusEntityTypeConfig<DeliveryExecuted>, IEntityTypeConfiguration<DeliveryExecuted>
    {
        public override void Configure(EntityTypeBuilder<DeliveryExecuted> builder)
        {
            base.Configure(builder);

            #region 主外键关系
            #endregion

            #region 字段属性:最大长度,是否必需,默认值
            builder.Property(p => p.PrepareId).HasMaxLength(EntityDefinition.DefSmallColLen).IsRequired();
            builder.Property(p => p.DispatchTaskId).HasMaxLength(EntityDefinition.DefSmallColLen).IsRequired();
            builder.Property(p => p.Count).IsRequired();
            builder.Property(p => p.DeliveryTime).IsRequired();
            #endregion

            #region 备注
            builder.HasComment("物料配送记录");
            builder.Property(p => p.PrepareId).HasComment("备料Id");
            builder.Property(p => p.DispatchTaskId).HasComment("Agv调度任务Id");
            builder.Property(p => p.Count).HasComment("配送数量（按台套）");
            builder.Property(p => p.DeliveryTime).HasComment("配送时间");
            #endregion

            #region 种子数据
            #endregion
        }
    }
}
